import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class crab here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class crab extends Actor
{
    /**
     * Act - do whatever the crab wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
         move(3);
         turnAtEdge();
         control();
    }
     public void turnAtEdge()
    {
      if(isAtEdge())
    {
          turn(5);
    }    
    }
    public void control(){
        if(Greenfoot.isKeyDown("left"))
        {
            turn(-10);
        }
        if(Greenfoot.isKeyDown("right"))
        {
            turn(10);
        }
    }
}
       

       


